function fun_upecmms_detailtext(i){//取出数据区域文本
    var s =$("#upecmmsMake_detailtext_" + i).html();
    var r ='<a xmlns="http://www.w3.org/1999/xhtml">';
    if(s.indexOf(r)==0){
        s =s.substring(r.length,s.length-4)
    }
    if(s.length>40){
        $("#upecmmsMake_detailtext_" + i).html(upecmmsMake_tabRowArry[i].textString.substring(0,40).replaceAll("\n", "<br>"));
    }else{
        $("#upecmmsMake_detailtext_" + i).html(upecmmsMake_tabRowArry[i].textString.replaceAll("\n", "<br>"));
    }
}

function fun_upecmmsMake_tabHml(){//帧列表添加帧
	return "<tr id='upecmmsFrame_zs_make"+upecmmsmake.sort+"' class=''><td width='50%' valign='top' class='preview'><div id='upecmms_make_tber_"+upecmmsmake.sort+"' class=''></div><div id='upecmms_make_img"+upecmmsmake.sort+"' class='imgs'><img id='upecmms_make_img_"+upecmmsmake.sort+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='upecmms_make_ring_"+upecmmsmake.sort+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='upecmms_make_text_"+upecmmsmake.sort+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='upecmms_make_ms_"+upecmmsmake.sort+"' class='second cl'>0 秒</p><p id='upecmms_make_del_"+upecmmsmake.sort+"' class=''></p></a></td></tr>"
            +"<tr id='upecmmsFrame_zs_make"+(upecmmsmake.sort+1)+"' class=''><td width='50%' valign='top' class='preview'><div id='upecmms_make_tber_"+(upecmmsmake.sort+1)+"' class=''></div><div id='upecmms_make_img"+(upecmmsmake.sort+1)+"' class='imgs'><img id='upecmms_make_img_"+(upecmmsmake.sort+1)+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='upecmms_make_ring_"+(upecmmsmake.sort+1)+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='upecmms_make_text_"+(upecmmsmake.sort+1)+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='upecmms_make_ms_"+(upecmmsmake.sort+1)+"' class='second cl'>0 秒</p><p id='upecmms_make_del_"+(upecmmsmake.sort+1)+"' class=''></td></tr>"
            +"<tr id='upecmmsFrame_zs_make"+(upecmmsmake.sort+2)+"' class=''><td width='50%' valign='top' class='preview'><div id='upecmms_make_tber_"+(upecmmsmake.sort+2)+"' class=''></div><div id='upecmms_make_img"+(upecmmsmake.sort+2)+"' class='imgs'><img id='upecmms_make_img_"+(upecmmsmake.sort+2)+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='upecmms_make_ring_"+(upecmmsmake.sort+2)+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='upecmms_make_text_"+(upecmmsmake.sort+2)+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='upecmms_make_ms_"+(upecmmsmake.sort+2)+"' class='second cl'>0 秒</p><p id='upecmms_make_del_"+(upecmmsmake.sort+2)+"' class=''></td></tr>"
            +"<tr id='upecmmsFrame_zs_make"+(upecmmsmake.sort+3)+"' class=''><td width='50%' valign='top' class='preview'><div id='upecmms_make_tber_"+(upecmmsmake.sort+3)+"' class=''></div><div id='upecmms_make_img"+(upecmmsmake.sort+3)+"' class='imgs'><img id='upecmms_make_img_"+(upecmmsmake.sort+3)+"' src='images/tmp.jpg'/></div></td>"
            +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='upecmms_make_ring_"+(upecmmsmake.sort+3)+"' class='ico-ring-gray'></span></td>"
            +"<td><span id='upecmms_make_text_"+(upecmmsmake.sort+3)+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='upecmms_make_ms_"+(upecmmsmake.sort+3)+"' class='second cl'>0 秒</p><p id='upecmms_make_del_"+(upecmmsmake.sort+3)+"' class=''></td></tr>"
}

function upecmms_make_downdata(){//帧列表下拉
	mmsMakeDowndata(upecmmsmake,"upecmmsFrame_zs_make");
}

function upecmms_make_updata(){//帧列表上拉
	mmsMakeUpdata(upecmmsmake,"upecmmsFrame_zs_make");
}

function fun_upecmmsimage_loadcheck(e,i){//本地资源选中图片时
	var picName =$("#upecmms_ick_load_"+i+"_fileName").val();
    var picSize =$("#upecmms_ick_load_"+i+"_fileLen").val();
    var picPath =$("#upecmms_ick_load_"+i+"_filePath").val();
    var picType =$("#upecmms_ick_load_"+i+"_fileSuf").val();
    if(e.checked){//选中
        if($("#upecmms_zimg_make").attr("alt")=="t"){
            alertmsg("同一帧不能插入两张图片!","alert");
            e.checked=false;
            return false;
        }
        if(upecmmsmake.sortsourceIds.length==0){//存储稿件源
            upecmmsmake.sortsourceIds=e.id;
        }else{
            upecmmsmake.sortsourceIds+=","+e.id;
        }
        $("#upecmms_zimg_make").attr("src",mDiv.remotehostipport+picPath);
        $("#upecmms_zimg_make").attr("alt","t");
        //fun_mms_zsize(upecmmsmake,picSize);
        upecmmsmake.mmssize += parseInt(picSize);
        $("#upecmms_zsize_make").html("快讯大小： "+upecmmsmake.mmssize+"KB/ "+upecmmsmake.mmsallsize+"KB ");
        upecmmsmake.picName = picName; 
        upecmmsmake.picSize = picSize; 
        upecmmsmake.picType = picType; 
        upecmmsmake.picPath = picPath; 
        upecmmsmake.picsoId = ""; 
    }else{
        var ssarr =upecmmsmake.sortsourceIds.split(",");
    	var ssarrlength =ssarr.length;
    	var newssarr =new Array();
    	var isfalse =false;
    	for(var k=0;k<ssarrlength;k++){
	        if(ssarr[k] == e.id) {
	        	isfalse =true;
	        }else{
	            newssarr.push(ssarr[k]);
	        }
	    }
        if(isfalse){
             $("#upecmms_zimg_make").attr("src","images/tmp.jpg");
             $("#upecmms_zimg_make").attr("alt","f");
             upecmmsmake.mmssize += parseInt(-picSize);
             $("#upecmms_zsize_make").html("快讯大小： "+upecmmsmake.mmssize+"KB/ "+upecmmsmake.mmsallsize+"KB ");
             upecmmsmake.picName = ""; 
             upecmmsmake.picSize = ""; 
             upecmmsmake.picType = ""; 
             upecmmsmake.picPath = ""; 
             upecmmsmake.picsoId = ""; 
             upecmmsmake.sortsourceIds =newssarr.join();//新的复选框源
        }
    }
}

function fun_upecmmsring_loadcheck(e,i){//本地资源选中铃声时
    var ringName =$("#upecmms_rck_load_"+i+"_fileName").val();
    var ringSize =$("#upecmms_rck_load_"+i+"_fileLen").val();
    var ringPath =$("#upecmms_rck_load_"+i+"_filePath").val();
    var ringUrl =$("#upecmms_rck_load_"+i+"_fileUrl").val().replaceAll("&amp;", "&");
    var ringType =$("#upecmms_rck_load_"+i+"_fileSuf").val();
    
    if(e.checked){//选中
        if($("#upecmms_ring_make").html().length>0){
            alertmsg("同一帧不能插入两个铃声!","alert");
            e.checked=false;
            return false;
        }  
        if(upecmmsmake.sortsourceIds.length==0){
            upecmmsmake.sortsourceIds=e.id;
        }else{
            upecmmsmake.sortsourceIds+=","+e.id;
        }
        $("#upecmms_ring_make").html("铃声：<a href='"+ringUrl+"'>"+ringName+"</a>");
        $("#upecmms_rv_make").show();

        upecmmsmake.mmssize += parseInt(ringSize);
        $("#upecmms_zsize_make").html("快讯大小： "+upecmmsmake.mmssize+"KB/ "+upecmmsmake.mmsallsize+"KB ");
        upecmmsmake.ringName = ringName;
        upecmmsmake.ringSize = ringSize;
        upecmmsmake.ringType = ringType;
        upecmmsmake.ringPath = ringPath;
        upecmmsmake.ringDownload ="";
        upecmmsmake.ringsoId = ""; 

    }else{
    	var ssarr =upecmmsmake.sortsourceIds.split(",");
    	var ssarrlength =ssarr.length;
    	var newssarr =new Array();
    	var isfalse =false;
    	for(var k=0;k<ssarrlength;k++){
	        if(ssarr[k] == e.id) {
	        	isfalse =true;
	        }else{
	            newssarr.push(ssarr[k]);
	        }
	    }
        if(isfalse){
             $("#upecmms_ring_make").html("");
             $("#upecmms_rv_make").hide();
             upecmmsmake.mmssize += parseInt(-ringSize);
             $("#upecmms_zsize_make").html("快讯大小： "+upecmmsmake.mmssize+"KB/ "+upecmmsmake.mmsallsize+"KB ");
             upecmmsmake.ringName = ""; 
             upecmmsmake.ringSize = ""; 
             upecmmsmake.ringType = ""; 
             upecmmsmake.ringPath = ""; 
             upecmmsmake.ringDownload ="";
             upecmmsmake.ringsoId = "";
             upecmmsmake.sortsourceIds =newssarr.join();
        }
    }

}

function fun_upecmms_arry(){
    var sortlength =upecmmsMake_sortsize.length;
	var newsortarr =new Array();
	for(var i=0;i<sortlength;i++){
		if(i<(upecmmsmake.sort-1)){
		    newsortarr.push(upecmmsMake_sortsize[i]);
		}else if(i==(upecmmsmake.sort-1)){
	        newsortarr.push(upecmmsmake.mmssize);
	    }else{
	        newsortarr.push(upecmmsMake_sortsize[i-1]);
	    }
	}
	newsortarr.push(upecmmsMake_sortsize[sortlength-1]);
	upecmmsMake_sortsize =newsortarr;

	var sIdlength =upecmmsMake_sortsourceId.length;
	var newsIdarr =new Array();
	for(var i=0;i<sIdlength;i++){
	    if(i<(upecmmsmake.sort-1)){
		    newsIdarr.push(upecmmsMake_sortsourceId[i]);
		}else if(i==(upecmmsmake.sort-1)){
			newsIdarr.push(upecmmsmake.sortsourceIds);
	    }else{
	        newsIdarr.push(upecmmsMake_sortsourceId[i-1]);
	    }
	}
	newsIdarr.push(upecmmsMake_sortsourceId[sIdlength-1]);
	upecmmsMake_sortsourceId =newsIdarr;
}

function fun_upecmmsMake_textsize() {//修改帧大小及字数
    upecmmsmake.textContent =$("#upecmms_textString_make").val();
    var bs =getBytesCount(upecmmsmake.textContent);//文本字节大小
    bs =fSizeJs(bs);
    var zs =upecmmsmake.textContent.length//文本字数
    var picsize =0,ringsize =0;
    upecmmsmake.textContentSize =bs;
    $("#upecmms_wbzs_make").html("备注：当前文本字数 "+zs);
    if(zs>800){
          $("#upecmms_wbzs_make").attr("class","redcolor");
    }else{
         $("#upecmms_wbzs_make").attr("class","");
    }
    if(upecmmsmake.picSize.length>0){
        picsize= parseInt(upecmmsmake.picSize);
    }
    if(upecmmsmake.ringSize.length>0){
        ringsize= parseInt(upecmmsmake.ringSize);
    }
    //bs +=picsize+ringsize;
    upecmmsmake.mmssize =bs+picsize+ringsize;
    /**
    if(upecmmsmake.insert>-1){
        upecmmsmake.mmsallsize =upecmmsmake.mmsallsize+bs;
        var sortlength =upecmmsMake_sortsize.length;
		var newsortarr =new Array();
		for(var i=0;i<sortlength;i++){//取出帧大小放入新的数组
			if(i<(upecmmsmake.sort-1)){
			    newsortarr.push(upecmmsMake_sortsize[i]);
			}else if(i==(upecmmsmake.sort-1)){
		        newsortarr.push(bs);
		    }else{
		        newsortarr.push(upecmmsMake_sortsize[i-1]);
		    }
		}
		newsortarr.push(upecmmsMake_sortsize[sortlength-1]);
		upecmmsMake_sortsize =newsortarr;

		var sIdlength =upecmmsMake_sortsourceId.length;
		var newsIdarr =new Array();
		for(var i=0;i<sIdlength;i++){//每帧复选框源放入新的数组
		    if(i!=(upecmmsmake.sort-1)){
		        newsIdarr.push(upecmmsMake_sortsourceId[i]);
		    }
		    if(i<(upecmmsmake.sort-1)){
			    newsIdarr.push(upecmmsMake_sortsourceId[i]);
			}else if(i==(upecmmsmake.sort-1)){
		        newsortarr.push(upecmmsmake.sortsourceIds);
		    }else{
		        newsIdarr.push(upecmmsMake_sortsourceId[i-1]);
		    }
		}
		newsIdarr.push(upecmmsMake_sortsourceId[sIdlength-1]);
		upecmmsMake_sortsourceId =newsIdarr;

    }else if(upecmmsmake.update>-1){
    	if(upecmmsmake.lastsize==0){
    		if(bs>0){
    		    upecmmsmake.mmsallsize =upecmmsmake.mmsallsize+bs-upecmmsMake_sortsize[upecmmsmake.sort-1];
    		}
    	}else{
    		if(bs>0){
    		    upecmmsmake.mmsallsize =upecmmsmake.mmsallsize+bs-upecmmsmake.lastsize;
    		}
    	}
    }else{
    	if(upecmmsmake.lastsize==0){
    		upecmmsmake.mmsallsize =upecmmsmake.mmsallsize+bs-picsize-ringsize;
    	}else{
    	    upecmmsmake.mmsallsize =upecmmsmake.mmsallsize+bs-upecmmsmake.lastsize;
    	}
    }
    upecmmsmake.lastsize =bs;
    **/
    $("#upecmms_zsize_make").html("快讯大小： "+upecmmsmake.mmssize+"KB/ "+upecmmsmake.mmsallsize+"KB ");
}

function fun_upecmmsMake_Chackdata() {//新增修改帧验证数据
	var ms = $("#upecmms_make_zhems").val();
	var ring = $("#upecmms_ring_make").html();
	var imgalt = $("#upecmms_zimg_make").attr("alt");
	var textstr = $("#upecmms_textString_make").val();
	if (ms.length == 0) {
		alertmsg(" '秒数'不能为空!", "alert");
		return false;
	} else {
		if (Number(ms) > 999) {
			alertmsg(" '秒数'最大不能超过999秒!", "alert");
			return false;
		} else {
			if (ring.length == 0 && imgalt == "f" && textstr.length == 0) {
				alertmsg("不能加入空白帧到帧列表!", "alert");
				return false;
			}
		}
	}
	
	if (!checkCharText(textstr)){
		 return false;
	}
	
	upecmmsmake.playTime =ms;
	return true;
}

function fun_upecmmsMake_saveZhen() {//新增保存帧
	var mmsSubObj = new fun_ecmmsMake_subObj(upecmmsmake);
	mmsSubObj.playTime = upecmmsmake.playTime;
	mmsSubObj.sort = upecmmsmake.sort;
	mmsSubObj.textContent = upecmmsmake.textContent; 
	mmsSubObj.textContentSize = upecmmsmake.textContentSize; 
	mmsSubObj.textsourceId=upecmmsmake.textsourceId;
	mmsSubObj.picName = upecmmsmake.picName; 
	mmsSubObj.picSize = upecmmsmake.picSize; 
	mmsSubObj.picType = upecmmsmake.picType; 
	mmsSubObj.picPath = upecmmsmake.picPath; 
	mmsSubObj.picsoId = upecmmsmake.picsoId; 
	mmsSubObj.ringName = upecmmsmake.ringName;
	mmsSubObj.ringSize = upecmmsmake.ringSize;
	mmsSubObj.ringType = upecmmsmake.ringType;
	mmsSubObj.ringPath = upecmmsmake.ringPath;
	mmsSubObj.ringsoId = upecmmsmake.ringsoId; 
	mmsSubObj.ringDownload = upecmmsmake.ringDownload; 
	upecmmsMainObj.addSubObj(mmsSubObj);
	upecmmsMake_sortsize[upecmmsmake.sort-1] =upecmmsmake.mmssize;
	upecmmsMake_sortsourceId[upecmmsmake.sort-1] =upecmmsmake.sortsourceIds;
}

function fun_upecmmsMake_saverefZhenList() {//新增刷新帧列表
	if(upecmmsmake.sort>upecmmsmake.pagezise&&upecmmsmake.sort%upecmmsmake.pagezise==1){
        upecmmsmake.pagecount++; 
	    $("#upecmmsFrame_zs_make").append(fun_upecmmsMake_tabHml());//添加帧列表数据
	    upecmms_make_downdata();//下拉一页
	}
	$("#upecmms_make_tber_"+upecmmsmake.sort).html(upecmmsmake.sort+"/"+upecmmsmake.allsort);//帧标题
	$("#upecmms_make_tber_"+upecmmsmake.sort).attr("class","frameNumber");
	$("#upecmms_make_ms_"+upecmmsmake.sort).html(upecmmsmake.playTime+" 秒");//秒数
	for(var i=upecmmsmake.sort-1;i<upecmmsmake.sort&&i>0;i--){//帽新帧标题
		var h =$("#upecmms_make_tber_"+i).html();
        h=h.substring(0,h.indexOf("/"));
	    $("#upecmms_make_tber_"+i).html(h+"/"+upecmmsmake.allsort);
	}
	if(upecmmsmake.textContent.length>0){//文字
	    $("#upecmms_make_text_"+upecmmsmake.sort).attr("class","ico-txt");
	}
	if($("#upecmms_zimg_make").attr("alt")=="t"){//图片
	    $("#upecmms_make_img_"+upecmmsmake.sort).attr("src",mDiv.remotehostipport+upecmmsmake.picPath);
	}
	if($("#upecmms_ring_make").html().length>0){//铃声
	    $("#upecmms_make_ring_"+upecmmsmake.sort).attr("class","ico-ring");
	}
	$("#upecmms_make_img"+upecmmsmake.sort).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_loadOne("+upecmmsmake.sort+")'>"+$("#upecmms_make_img"+upecmmsmake.sort).html()+"</a>");

    if(upecmmsmake.sort>1){
    	$("#upecmms_make_del_"+upecmmsmake.allsort).attr("class","delframe");
        $("#upecmms_make_del_"+upecmmsmake.allsort).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_delOne("+upecmmsmake.allsort+")'>删 除</a>");
    }
}

function fun_upecmmsMake_clearData(zhe) {//清空数据区域
    upecmmsmake.textContent="";
    upecmmsmake.textContentSize=0;
    upecmmsmake.textsourceId = "";
    upecmmsmake.playTime=10;
    upecmmsmake.mmssize=0;
    upecmmsmake.picName = ""; 
	upecmmsmake.picSize = ""; 
	upecmmsmake.picType = ""; 
	upecmmsmake.picPath = ""; 
	upecmmsmake.picsoId="";

	upecmmsmake.ringName = "";
	upecmmsmake.ringSize = "";
	upecmmsmake.ringType = "";
	upecmmsmake.ringPath = "";
	upecmmsmake.ringsoId ="";

	upecmmsmake.ringDownload ="";
	upecmmsmake.sortsourceIds="";
	upecmmsmake.lastsize=0;
	
	$("#upecmms_make_zhems").val(10);//秒数
	$("#upecmms_make_indexzs").html("当前帧：第 "+zhe+" 帧 时间");
	$("#upecmms_zimg_make").attr("src","images/tmp.jpg");//图片
    $("#upecmms_zimg_make").attr("alt","f");
    $("#upecmms_zsize_make").html("快讯大小： 0B/ "+upecmmsmake.mmsallsize+"KB ");//大小
    $("#upecmms_textString_make").val("");//文字
    $("#upecmms_wbzs_make").html("备注：当前文本字数 0");
    $("#upecmms_wbzs_make").attr("class","");
    $("#upecmms_ring_make").html("");//铃声
    $("#upecmms_rv_make").hide();
}

function fun_upecmmsMake_loadOne(zhe){//修改加载数据
	if(upecmmsmake.insert>0){
		alertmsg("当前为插入帧状态 不能修改帧!","alert");
        return;
	}
    fun_upecmmsMake_clearData(zhe);
    upecmmsmake.update =zhe;
    $("#upecmmsFrame_zs_make").find("tr.current").attr("class","");
    $("#upecmmsFrame_zs_make"+zhe).attr("class","current");
    var subObj =upecmmsMainObj.getSubObj(zhe-1);
    upecmmsmake.playTime =subObj.playTime
    upecmmsmake.sort =zhe;
    $("#upecmms_make_zhems").val(subObj.playTime);
    
    if(subObj.picPath.length>0){
        $("#upecmms_zimg_make").attr("src",mDiv.remotehostipport+subObj.picPath);
        $("#upecmms_zimg_make").attr("alt","t");
        upecmmsmake.picName = subObj.picName; 
        upecmmsmake.picSize = subObj.picSize; 
        upecmmsmake.picType = subObj.picType; 
        upecmmsmake.picPath = subObj.picPath; 
        upecmmsmake.picsoId = subObj.picsoId; 
    }
    if(subObj.ringPath.length>0){
    	if(subObj.ringDownload.length>0){
    	    $("#upecmms_ring_make").html("铃声：<a href='"+subObj.ringDownload+"'>"+subObj.ringName+"</a>");
    	}else{
    	    $("#upecmms_ring_make").html("铃声："+subObj.ringName);
    	}
        $("#upecmms_rv_make").show();
        upecmmsmake.ringName = subObj.ringName;
        upecmmsmake.ringSize = subObj.ringSize;
        upecmmsmake.ringType = subObj.ringType;
        upecmmsmake.ringPath = subObj.ringPath;
        upecmmsmake.ringsoId = subObj.ringsoId; 
        upecmmsmake.ringDownload =subObj.ringDownload;
    }
    if(subObj.textContent.length>0){
        $("#upecmms_textString_make").val(subObj.textContent);
        var zs =subObj.textContent.length//文本字数
        $("#upecmms_wbzs_make").html("备注：当前文本字数 "+zs);
        if(zs>800){
              $("#upecmms_wbzs_make").attr("class","redcolor");
        }else{
             $("#upecmms_wbzs_make").attr("class","");
        }
        upecmmsmake.textContent =subObj.textContent;
        upecmmsmake.textContentSize=subObj.textContentSize;
        upecmmsmake.textsourceId=subObj.textsourceId;
    }
    upecmmsmake.mmssize =upecmmsMake_sortsize[zhe-1];
    upecmmsmake.upmmssize =upecmmsMake_sortsize[zhe-1];
    upecmmsmake.sortsourceIds =upecmmsMake_sortsourceId[zhe-1];
    
    var ssarr ="";
    if(typeof(upecmmsmake.sortsourceIds)!="undefined"){
        ssarr= upecmmsmake.sortsourceIds.split(",");
    }
	var ssarrlength =ssarr.length;
	for(var k=0;k<ssarrlength;k++){
		if(ssarr[k].length>0){
		    $("#"+ssarr[k])[0].checked=true;
		}
    }
	
    $("#upecmms_zsize_make").html("快讯大小： "+upecmmsmake.mmssize+"KB/ "+upecmmsmake.mmsallsize+"KB ");
    $("#upecmms_make_addbtn").html("<img src='images/modifybtn.gif' width='65' height='23' border='0' onclick='fun_upecmms_upone("+zhe+")'>");
    if(zhe>1){
        $("#upecmms_insert_zhe").html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_insert("+zhe+")' class='insertFrame floatr'>插入帧</a>快讯帧列表");
    }
    
}

function fun_upecmmsMake_updateZhen(zhe) {//修改帧数据
	var mmsSubObj = new fun_ecmmsMake_subObj(upecmmsmake);
	//mmsSubObj.sourceId =mmsmake.sourceId;
	mmsSubObj.playTime = upecmmsmake.playTime;
	mmsSubObj.sort = upecmmsmake.sort;
	mmsSubObj.textContent = upecmmsmake.textContent; 
	mmsSubObj.textContentSize = upecmmsmake.textContentSize; 
	mmsSubObj.textsourceId=upecmmsmake.textsourceId;
	mmsSubObj.picName = upecmmsmake.picName; 
	mmsSubObj.picSize = upecmmsmake.picSize; 
	mmsSubObj.picType = upecmmsmake.picType; 
	mmsSubObj.picPath = upecmmsmake.picPath; 
	mmsSubObj.picsoId = upecmmsmake.picsoId; 
	mmsSubObj.ringName = upecmmsmake.ringName;
	mmsSubObj.ringSize = upecmmsmake.ringSize;
	mmsSubObj.ringType = upecmmsmake.ringType;
	mmsSubObj.ringPath = upecmmsmake.ringPath;
	mmsSubObj.ringsoId = upecmmsmake.ringsoId; 
	mmsSubObj.ringDownload = upecmmsmake.ringDownload;
	upecmmsMainObj.periodicalSubArr[zhe-1] =mmsSubObj;
	upecmmsMake_sortsize[upecmmsmake.sort-1] =upecmmsmake.mmssize;
	upecmmsMake_sortsourceId[upecmmsmake.sort-1] =upecmmsmake.sortsourceIds;
	upecmmsmake.sort=upecmmsmake.allsort+1;
}


function fun_upecmmsMake_uprefZhenList(zhe) {//修改刷新帧列表
	$("#upecmmsFrame_zs_make"+zhe).attr("class","");
	$("#upecmms_make_ms_"+zhe).html(upecmmsmake.playTime+" 秒");//秒数

	if(upecmmsmake.textContent.length>0){//文字
	    $("#upecmms_make_text_"+zhe).attr("class","ico-txt");
	}else{
	    $("#upecmms_make_text_"+zhe).attr("class","ico-txt-gray");
	}
	if($("#upecmms_zimg_make").attr("alt")=="t"){//图片
	    $("#upecmms_make_img_"+zhe).attr("src",mDiv.remotehostipport+upecmmsmake.picPath);
	}else{
	    $("#upecmms_make_img_"+zhe).attr("src","images/tmp.jpg");
	}
	if($("#upecmms_ring_make").html().length>0){//铃声
	    $("#upecmms_make_ring_"+zhe).attr("class","ico-ring");
	}else{
	    $("#upecmms_make_ring_"+zhe).attr("class","ico-ring-gray");
	}
	$("#upecmms_make_img"+zhe).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_loadOne("+zhe+")'>"+$("#upecmms_make_img"+zhe).html()+"</a>");
	$("#upecmms_make_addbtn").html("<img src='images/addbtn.gif' width='65' height='23' border='0' onClick='fun_upecmms_addone()'>");
	$("#upecmms_insert_zhe").html("<a href='#' class='insertFrame-gray floatr'>插入帧</a>快讯帧列表");
}


function fun_upecmms_insertZhe(){
    var mmsSubObj = new fun_ecmmsMake_subObj(upecmmsmake);
	mmsSubObj.playTime = upecmmsmake.playTime;
	mmsSubObj.sort = upecmmsmake.sort;
	mmsSubObj.textContent = upecmmsmake.textContent; 
	mmsSubObj.textContentSize = upecmmsmake.textContentSize; 
	mmsSubObj.textsourceId=upecmmsmake.textsourceId;
	mmsSubObj.picName = upecmmsmake.picName; 
	mmsSubObj.picSize = upecmmsmake.picSize; 
	mmsSubObj.picType = upecmmsmake.picType; 
	mmsSubObj.picPath = upecmmsmake.picPath; 
	mmsSubObj.picsoId = upecmmsmake.picsoId; 
	mmsSubObj.ringName = upecmmsmake.ringName;
	mmsSubObj.ringSize = upecmmsmake.ringSize;
	mmsSubObj.ringType = upecmmsmake.ringType;
	mmsSubObj.ringPath = upecmmsmake.ringPath;
	mmsSubObj.ringsoId = upecmmsmake.ringsoId; 
	mmsSubObj.ringDownload = upecmmsmake.ringDownload; 
	upecmmsMainObj.insertSubObj(upecmmsmake.insert,mmsSubObj);
}

function fun_upecmmsMake_insertrefZhenList() {//新增刷新帧列表
	$("#upecmms_make_ms_"+upecmmsmake.sort).html(upecmmsmake.playTime+" 秒");//秒数
	if(upecmmsmake.textContent.length>0){//文字
	    $("#upecmms_make_text_"+upecmmsmake.sort).attr("class","ico-txt");
	}
	if($("#upecmms_zimg_make").attr("alt")=="t"){//图片
	    $("#upecmms_make_img_"+upecmmsmake.sort).attr("src",mDiv.remotehostipport+upecmmsmake.picPath);
	}
	if($("#upecmms_ring_make").html().length>0){//铃声
	    $("#upecmms_make_ring_"+upecmmsmake.sort).attr("class","ico-ring");
	}
	$("#upecmms_make_addbtn").html("<img src='images/addbtn.gif' width='65' height='23' border='0' onClick='fun_upecmms_addone()'>");
	$("#upecmms_make_img"+upecmmsmake.sort).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_loadOne("+upecmmsmake.sort+")'>"+$("#upecmms_make_img"+upecmmsmake.sort).html()+"</a>");
}

function fun_upecmmsMake_delrefZhenList(){//删除刷新帧列表
    if(upecmmsmake.allsort%upecmmsmake.pagezise==0){
        upecmmsmake.pagecount =upecmmsmake.allsort/upecmmsmake.pagezise;//总页数
        //upecmmsmake.page =upecmmsmake.pagecount;
        $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort+1)).remove();
        $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort+2)).remove();
        $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort+3)).remove();
        $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort+4)).remove();
	    if(upecmmsmake.page>=upecmmsmake.pagecount){
	        $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort-3)).show();
		    $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort-2)).show();
		    $("#upecmmsFrame_zs_make"+(upecmmsmake.allsort-1)).show();
		    $("#upecmmsFrame_zs_make"+upecmmsmake.allsort).show();
		    upecmmsmake.page =upecmmsmake.pagecount;
        }
    }
}

function fun_upecmmsMake_cleardel(zhe) {//删除清空数据区域
	if(zhe==upecmmsmake.allsort+1){
		for(var i=1;i<=upecmmsmake.allsort;i++){//帽新帧标题
			 var h =$("#upecmms_make_tber_"+i).html();
	         h=h.substring(0,h.indexOf("/"));
		     $("#upecmms_make_tber_"+i).html(h+"/"+upecmmsmake.allsort);
		}
	    $("#upecmms_make_del_"+(upecmmsmake.allsort+1)).html("");
	    $("#upecmms_make_del_"+(upecmmsmake.allsort+1)).attr("class","");
		$("#upecmms_make_ms_"+(upecmmsmake.allsort+1)).html("0 秒");//秒数
		$("#upecmms_make_tber_"+(upecmmsmake.allsort+1)).html("");
		$("#upecmms_make_tber_"+(upecmmsmake.allsort+1)).attr("class","");
		$("#upecmms_make_text_"+(upecmmsmake.allsort+1)).attr("class","ico-txt-gray");//帧列表显示灰
		$("#upecmms_make_img"+(upecmmsmake.allsort+1)).html("<img src='images/tmp.jpg' id='upecmms_make_img_"+(upecmmsmake.allsort+1)+"'>");
		$("#upecmms_make_ring_"+(upecmmsmake.allsort+1)).attr("class","ico-ring-gray");
	}else{
		//$("#upecmmsFrame_zs_make"+zhe).remove();//删除帧
		var leg =upecmmsmake.allsort+1;
		for(var i=1;i<=leg;i++){//帧列表向上移动
		     if(i<zhe){
		         var h =$("#upecmms_make_tber_"+i).html();
		         h=h.substring(0,h.indexOf("/"));
			     $("#upecmms_make_tber_"+i).html(h+"/"+upecmmsmake.allsort);
		     }else if(i==zhe){
		         //$("#upecmms_make_del_"+i).remove();
				 $("#upecmms_make_ms_"+i).html("0 秒");//秒数
				 $("#upecmms_make_tber_"+i).html("");
				 $("#upecmms_make_tber_"+i).attr("class","");
				 $("#upecmms_make_text_"+i).attr("class","ico-txt-gray");//帧列表显示灰
				 $("#upecmms_make_img_"+i).attr("src","images/tmp.jpg");
				 $("#upecmms_make_ring_"+i).attr("class","ico-ring-gray");
				 $("#upecmms_make_img"+i).html($("#upecmms_make_img"+i).find("a").html());
		     }else{
				 $("#upecmms_make_ms_"+(i-1)).html($("#upecmms_make_ms_"+i).html());//秒数
				 $("#upecmms_make_text_"+(i-1)).attr("class",$("#upecmms_make_text_"+i).attr("class"));
				 $("#upecmms_make_img_"+(i-1)).attr("class",$("#upecmms_make_img_"+i).attr("class"));
				 $("#upecmms_make_ring_"+(i-1)).attr("class",$("#upecmms_make_ring_"+i).attr("class"));
			     
				 if(mDiv.bwsType=="mozilla"){
					 var loadhtml =$("#upecmms_make_img"+i).html();
					 var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
					 newhtml +=(i-1)+')" ';
					 newhtml +=loadhtml.substring(loadhtml.indexOf("><img"),loadhtml.length);
					 var newhtml2="";
					 if(i>9){
					     newhtml2= newhtml.substring(0,loadhtml.indexOf("img_")+4);
					 }else{
					     newhtml2= newhtml.substring(0,loadhtml.indexOf("img_")+5);
					 }
					 if(i>10){
					 	newhtml2 +='_'+(i-1)+'" ';
					 }else{
					 	newhtml2 +=(i-1)+'" ';
					 }
					 newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
					 $("#upecmms_make_img"+(i-1)).html(newhtml2);
				 }else{
				     var loadhtml =$("#upecmms_make_img"+i).html();
					 var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
					 newhtml +=(i-1)+")  ";
					 newhtml +=loadhtml.substring(loadhtml.indexOf("><IMG"),loadhtml.length);
					 var newhtml2= newhtml.substring(0,newhtml.indexOf("make_img_")+9);
					 newhtml2 +=(i-1)+"  ";
					 newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
					 $("#upecmms_make_img"+(i-1)).html(newhtml2);
				 }
			     $("#upecmms_make_del_"+(i-1)).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_delOne("+(i-1)+")'>删 除</a>");
				 var h =$("#upecmms_make_tber_"+i).html();
		         h=parseInt(h.substring(0,h.indexOf("/")));
			     $("#upecmms_make_tber_"+(i-1)).html((h-1)+"/"+upecmmsmake.allsort);
	             $("#upecmms_make_tber_"+(i-1)).attr("class","frameNumber");
			     
			     if(i==leg){//清空最后一帧
			         $("#upecmms_make_del_"+i).html("");
			         $("#upecmms_make_del_"+i).attr("class","");
					 $("#upecmms_make_ms_"+i).html("0 秒");//秒数
					 $("#upecmms_make_tber_"+i).html("");
					 $("#upecmms_make_tber_"+i).attr("class","");
					 $("#upecmms_make_text_"+i).attr("class","ico-txt-gray");//帧列表显示灰
					 //$("#upecmms_make_img_"+i).attr("src","images/tmp.jpg");
					 $("#upecmms_make_ring_"+i).attr("class","ico-ring-gray");
					 $("#upecmms_make_img"+i).html("<img id='upecmms_make_img_"+i+"' src='images/tmp.jpg'>");
			     }
		     }
		}
	}
	
    upecmmsmake.mmsallsize = upecmmsmake.mmsallsize-upecmmsMake_sortsize[zhe-1];//修改总帧大小
	$("#upecmms_zsize_make").html("快讯大小： 0KB/ "+upecmmsmake.mmsallsize+"KB ");
	var addbtn =$("#upecmms_make_addbtn").html();
	if(addbtn.indexOf("addbtn.gif")>0){
	    $("#upecmms_make_indexzs").html("当前帧：第 "+(upecmmsmake.allsort+1)+" 帧 时间");
	}

	var sIdlength =upecmmsMake_sortsourceId.length;
	var newsIdarr =new Array();
	for(var i=0;i<sIdlength;i++){
	    if(i!=(zhe-1)){
	        newsIdarr.push(upecmmsMake_sortsourceId[i]);
	    }
	}
	upecmmsMake_sortsourceId =newsIdarr;
	
	var sortlength =upecmmsMake_sortsize.length;
	var newsortarr =new Array();
	for(var i=0;i<sortlength;i++){
	    if(i!=(zhe-1)){
	        newsortarr.push(upecmmsMake_sortsize[i]);
	    }
	}
	upecmmsMake_sortsize =newsortarr;
}

function fun_upecmmsMake_delete(zhe){//删除帧
	divBlockUIOpen('tab_periodical_update','正在删除第'+zhe+'帧...',false,0);
    var count =upecmmsMainObj.periodicalSubArr.length;
	var subObj,zhennum;
	var newarr =new Array();
    for(var i=0;i<count;i++){
        subObj = upecmmsMainObj.getSubObj(i);
        zhennum = subObj.sort;
        if(zhennum!=zhe){
        	if(zhennum>zhe){
        	    subObj.sort=zhennum-1;
        	}
        	newarr.push(subObj);
        }
    }
    upecmmsMainObj.periodicalSubArr =newarr;
    upecmmsmake.allsort--;
    upecmmsmake.sort--;
    fun_upecmmsMake_cleardel(zhe);//清空
    fun_upecmmsMake_delrefZhenList();//删除帧列表页
    fun_upecmmsMake_clearData(upecmmsmake.allsort+1);
    setTimeout(function() {$('#tab_periodical_update').unblock(); }, 1000)
}

function fun_upecmmsMake_delOne(zhe){//删除帧
	 if(upecmmsmake.insert>0){
		alertmsg("当前为插入帧状态 不能删除帧!","alert");
        return;
	 }
	 if(upecmmsmake.update>0){
		alertmsg("当前为插入帧状态 不能删除帧!","alert");
        return;
	 }
     if(parseInt(upecmmsmake.allsort)<2){
		alertmsg("彩信内容至少一帧！","alert");
	 }else{
		confirm("确认要删除 第"+zhe+"帧 吗？", fun_upecmmsMake_delete,zhe);
	 }
}

function fun_upecmmsMake_insert(zhe){
	upecmmsmake.insert =zhe;
//	var zhehtml="";
//    zhehtml="<tr id='upecmmsFrame_zs_make"+zhe+"' class=''><td width='50%' valign='top' class='preview'><div id='upecmms_make_tber_"+zhe+"' class=''></div><div id='upecmms_make_img"+zhe+"' class='imgs'><img id='upecmms_make_img_"+zhe+"' src='images/tmp.jpg'/></div></td>"
//        +"<td align='center' valign='top'><table border='0' align='left' cellpadding='0' cellspacing='0' class='icons'><tr><td><span id='upecmms_make_ring_"+zhe+"' class='ico-ring-gray'></span></td>"
//        +"<td><span id='upecmms_make_text_"+zhe+"' class='ico-txt-gray'></span></td><td><span class='ico-video-gray'></span></td></tr></table><p id='upecmms_make_ms_"+zhe+"' class='second cl'>0 秒</p><p id='upecmms_make_del_"+zhe+"' class=''></p></a></td></tr>";
//   $(zhehtml).insertBefore("#upecmmsFrame_zs_make"+zhe);
    upecmmsmake.sort =upecmmsmake.allsort+1;
    if(upecmmsmake.sort>upecmmsmake.pagezise&&upecmmsmake.sort%upecmmsmake.pagezise==1){
        upecmmsmake.pagecount++; 
	    $("#upecmmsFrame_zs_make").append(fun_upecmmsMake_tabHml());//添加帧列表数据
	}
    var leg =upecmmsmake.sort;
	for(var i=leg;i>0;i--){//帧列表向下移动
		if(i>zhe){
		    $("#upecmms_make_ms_"+i).html($("#upecmms_make_ms_"+(i-1)).html());//秒数
			$("#upecmms_make_text_"+i).attr("class",$("#upecmms_make_text_"+(i-1)).attr("class"));
			$("#upecmms_make_img_"+i).attr("class",$("#upecmms_make_img_"+(i-1)).attr("class"));
			$("#upecmms_make_ring_"+i).attr("class",$("#upecmms_make_ring_"+(i-1)).attr("class"));
			
			var loadhtml =$("#upecmms_make_img"+(i-1)).html();
			var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
			newhtml +=i+')" ';
			newhtml +=loadhtml.substring(loadhtml.indexOf("><img"),loadhtml.length);
			var newhtml2= newhtml.substring(0,newhtml.indexOf("_img")+5);
			newhtml2 +=i+'" ';
			newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);

			if(mDiv.bwsType=="mozilla"){
			    var loadhtml =$("#upecmms_make_img"+(i-1)).html();
				var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
				newhtml +=i+')" ';
				newhtml +=loadhtml.substring(loadhtml.indexOf("><img"),loadhtml.length);
				var newhtml2= newhtml.substring(0,newhtml.indexOf("_img")+5);
				newhtml2 +=i+'" ';
				newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
				$("#upecmms_make_img"+i).html(newhtml2);
			}else{
				var loadhtml =$("#upecmms_make_img"+(i-1)).html();
				var newhtml =loadhtml.substring(0,loadhtml.indexOf("One(")+4);
				newhtml +=i+")  ";
				newhtml +=loadhtml.substring(loadhtml.indexOf("><IMG"),loadhtml.length);
				var newhtml2= newhtml.substring(0,newhtml.indexOf("make_img_")+9);
				newhtml2 +=i+"  ";
				newhtml2 +=newhtml.substring(newhtml.indexOf("src"),newhtml.length);
				$("#upecmms_make_img"+i).html(newhtml2);
			}

			$("#upecmms_make_del_"+i).attr("class","delframe");
			$("#upecmms_make_del_"+i).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_delOne("+i+")'>删 除</a>"); 	 
		    $("#upecmms_make_tber_"+i).html(i+"/"+leg);
            $("#upecmms_make_tber_"+i).attr("class","frameNumber");
            
            //$("#upecmms_make_del_"+(i-1)).remove();
			$("#upecmms_make_ms_"+(i-1)).html("0 秒");//秒数
			$("#upecmms_make_tber_"+(i-1)).html("");
			$("#upecmms_make_tber_"+(i-1)).attr("class","");
			$("#upecmms_make_text_"+(i-1)).attr("class","ico-txt-gray");//帧列表显示灰
			$("#upecmms_make_ring_"+(i-1)).attr("class","ico-ring-gray");
			$("#upecmms_make_img"+(i-1)).html("<img id='upecmms_make_img_"+(i-1)+"' src='images/tmp.jpg'>");
			
		}else if(i==zhe){
			$("#upecmms_make_tber_"+i).html(zhe+"/"+leg);
            $("#upecmms_make_tber_"+i).attr("class","frameNumber");
            if(zhe>1){
                $("#upecmms_make_del_"+i).attr("class","delframe");
		        $("#upecmms_make_del_"+i).html("<a href='javascript:void(0)' onClick='fun_upecmmsMake_delOne("+zhe+")'>删 除</a>");
            }
			fun_upecmmsMake_clearData(zhe);
			$("#upecmms_insert_zhe").html("<a href='#' class='insertFrame-gray floatr'>插入帧</a>快讯帧列表");
			$("#upecmms_make_addbtn").html("<img src='images/insertbtn.gif' width='65' height='23' border='0' onClick='fun_upecmms_insertone()'>");
	   }else{
		    $("#upecmms_make_tber_"+i).html(i+"/"+leg);
            $("#upecmms_make_tber_"+i).attr("class","frameNumber");
	   }

	    var pages =upecmmsmake.page*upecmmsmake.pagezise;
	    if(i>pages){
	        $("#upecmmsFrame_zs_make"+i).hide();
	        $("#upecmmsFrame_zs_make"+(i+1)).hide();
	        $("#upecmmsFrame_zs_make"+(i+2)).hide();
	        $("#upecmmsFrame_zs_make"+(i+3)).hide();
	    }else if(i<(pages-3)){
	        $("#upecmmsFrame_zs_make"+i).hide();
	        $("#upecmmsFrame_zs_make"+(i-1)).hide();
	        $("#upecmmsFrame_zs_make"+(i-2)).hide();
	        $("#upecmmsFrame_zs_make"+(i-3)).hide();
	    }
	}
    upecmmsmake.sort =zhe;
}

function fun_ecmmsMakeUp_reList(){//重置列表到最后一页
		if(upecmmsmake.pagecount>1){
			 $("#upecmmsFrame_zs_make1").hide(); 
             $("#upecmmsFrame_zs_make2").hide();
             $("#upecmmsFrame_zs_make3").hide();
             $("#upecmmsFrame_zs_make4").hide();
             $("#upecmmsFrame_zs_make"+(upecmmsmake.pagecount*upecmmsmake.pagezise-3)).show();
		     $("#upecmmsFrame_zs_make"+(upecmmsmake.pagecount*upecmmsmake.pagezise-2)).show();
		     $("#upecmmsFrame_zs_make"+(upecmmsmake.pagecount*upecmmsmake.pagezise-1)).show();
		     $("#upecmmsFrame_zs_make"+(upecmmsmake.pagecount*upecmmsmake.pagezise)).show();
		     upecmmsmake.page=upecmmsmake.pagecount;
		}
	}